<?php 
/** Create By fu */
namespace app\api\model;

use think\Exception;
use think\Db;
use app\api\model\BaseModel;
/**
* 
*/
class Banner extends BaseModel
{
	//隐藏字段
	protected $hidden = ['update_time','delete_time'];
	
	//关联模型
	public function items()
	{
		// 一对多 hasMany(从表，从表字段，本表字段)
		return $this->hasMany('BannerItem','banner_id','id');
	}
	
	public static function getBannerByID($id)
	{
		$result = self::with(['items','items.img'])->find($id);
	   
		return $result;
	}
}




 ?>